﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Record.aspx.cs" Inherits="Reservoir.WebSite.Record" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="scripts/jquery-3.5.1.min.js"></script>
    <script>
        function Delete(id) {
            if (confirm("你确定要删除吗?")) {
                $.ajax({
                    url: "/Handler/DeleteHandler.ashx",
                    type: "post",
                    data: { "id": id },
                    dataType: "text",
                    success: function (data) {
                        if (data > 0) {
                            alert("删除失败");
                        } else {
                            alert("删除成功");
                            location.href = "Record.aspx";
                        }
                    }
                })
            }
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:GridView ID="gvTBRecordAddList" runat="server" AutoGenerateColumns="False">
                <Columns>
                    <asp:BoundField DataField="Id" HeaderText="编号" />
                    <asp:BoundField DataField="UserId" HeaderText="用户编号" />
                    <asp:BoundField DataField="District" HeaderText="所在地区" />
                    <asp:BoundField DataField="Name" HeaderText="水库名称" />
                    <asp:BoundField DataField="Area" HeaderText="水域面积" />
                    <asp:BoundField DataField="Storage" HeaderText="蓄水量" />
                    <asp:BoundField DataField="Functional" HeaderText="功能" />
                    <asp:BoundField DataField="Maximum" HeaderText="最高水位" />
                    <asp:BoundField DataField="Curent" HeaderText="当前水位" />
                    <asp:BoundField DataField="Remarks" HeaderText="备注" />
                    <asp:BoundField DataField="CreationTime" HeaderText="创建时间" DataFormatString="{0:yyyy-MM-dd hh:mm:ss}" />
                    <asp:TemplateField HeaderText="删除">
                        <ItemTemplate>
                            <a onclick='Delete(<%# Eval("Id") %>)'>删除</a>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
    </form>
</body>
</html>
